spectrum_filter Module



Variables

Type Visibility Attributes Name Initial
integer(kind=int32), public, parameter :: BAND_PASS_FILTER = 3

Denotes a band-pass filter.

integer(kind=int32), public, parameter :: BAND_STOP_FILTER = 4

Denotes a band-stop filter.

integer(kind=int32), public, parameter :: HIGH_PASS_FILTER = 2

Denotes a high-pass filter.

integer(kind=int32), public, parameter :: LOW_PASS_FILTER = 1

Denotes a low-pass filter.


Functions

public pure function filter(b, a, x, delays) result(rst)

Applies the specified filter to a signal.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: b(:)

The numerator coefficients of the rational transfer function.

real(kind=real64), intent(in) :: a(:)

The denominator coefficients of the ration transfer function. In the case of an FIR filter, this parameter should be set to a one-element array with a value of one. Regardless, the value of a(1) must be non-zero.

real(kind=real64), intent(in) :: x(:)

An N-element array containing the signal to filter.

real(kind=real64), intent(in), optional, target :: delays(:)

An optional array of length MAX(size(a), size(b)) - 1 that provides the initial conditions for filter delays, and on ouput, the final conditions for filter delays.

Return Value real(kind=real64), allocatable, (:)

An N-element array containing the filtered signal.

public pure function gaussian_filter(x, alpha, k) result(rst)

Applies a Gaussian filter to a signal.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: x(:)

An N-element array containing the signal to filter.

real(kind=real64), intent(in) :: alpha

A parameter that specifies the number of standard deviations desired in the kernel. This parameter is related to the standard deviation by .

integer(kind=int32), intent(in) :: k

The kernel size. This value must be a positive, non-zero integer value less than N.

Return Value real(kind=real64), allocatable, (:)

An N-element array containing the filtered signal.

public pure function moving_average_filter(navg, x) result(rst)

Applies a moving average filter to a signal.

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: navg

The size of the averaging window. This parameter must be positive and non-zero.

real(kind=real64), intent(in) :: x(:)

An N-element array containing the signal to filter.

Return Value real(kind=real64), allocatable, (:)

An N-element array containing the filtered signal.

public pure function sinc_filter(fc, fs, x, fc2, ftype) result(rst)

Applies a sinc-in-time filter (rectangular frequency response).

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: fc

The filter cutoff frequency, in Hz.

real(kind=real64), intent(in) :: fs

The sampling frequency, in Hz.

real(kind=real64), intent(in), dimension(:) :: x

The signal to filter.

real(kind=real64), intent(in), optional :: fc2

The second cutoff frequency for band-pass and band-stop filters.

integer(kind=int32), intent(in), optional :: ftype

The filter type. This parameter must be one of the following values:

Read more…

Return Value real(kind=real64), allocatable, dimension(:)

The filtered signal.

public pure function tv_filter(x, lambda, niter) result(rst)

Applies a total-variation filter to a signal.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: x(:)

An N-element array containing the signal to filter.

real(kind=real64), intent(in) :: lambda

The regularization parameter. The actual value to use is problem dependent, but the noisier the data, the larger this value should be. A good starting point is typically 0.3 - 0.5; however, the actual value is problem dependent.

integer(kind=int32), intent(in), optional :: niter

An optional parameter controlling the number of iterations performed. The default limit is 10 iterations.

Return Value real(kind=real64), allocatable, (:)

An N-element array containing the filtered signal.